package com.example.demo.collection;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

/**
 * @desc: <br/>
 * @author: Jingbo Hu<br/>
 * @time：2020年07⽉17⽇<br/>
 * @version：v1.0.0<br>
 */
public class HashMapDemo {

    public static void main(String[] args) throws InterruptedException {
        HashMap<String, String> map = new HashMap<String, String>(2);
        map.put(null,"value");
        map.put("name","zhangsan");
        map.put("sex","male");

        Iterator<Map.Entry<String, String>> iterator = map.entrySet().iterator();
        while (iterator.hasNext()){
            Map.Entry<String, String> next = iterator.next();
            String key = next.getKey();
            String value = next.getValue();
            System.out.println("key = " + key);
            System.out.println("value = " + value);
            System.out.println("===================");
        }

    }
}
